package com.interest.controller;

import com.ext.github.pojo.Repo;
import com.interest.controller.builder.ListModelAndViewBuilder;
import com.interest.modules.githubwrapper.service.GithubWrapperService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;

import java.util.List;

/**
 * Created by yangfeng on 16-12-19.
 */

@Controller
@RequestMapping("/github/repos")
public class GithubWrapperController {
    @Autowired
    private GithubWrapperService githubWrapperService;

    @RequestMapping("/list")
    public ModelAndView repoList(String user) {
        List<Repo> list = githubWrapperService.repoList(user);
        return new ListModelAndViewBuilder("github/repos", list).build();
    }
}
